package com.transferwallet.sdk;


import com.transferwallet.sdk.entity.ConfirmPayReq;
import com.transferwallet.sdk.entity.DrawbackReq;
import com.transferwallet.sdk.entity.OrderChangeStatusReq;
import com.transferwallet.sdk.entity.OrderSubmissionReq;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class Demo {


	public static void main(String[] args) {

		// 商户编码
		String memberCode = "";
		// 私钥
		String privateKey = "";

		// 服务host
		String serviceHost = "";

		// 创建sdk客户端
		TransferWalletClient transferWalletClient = new TransferWalletClient(memberCode, privateKey, serviceHost);
/*
		log.info("------2.1 商户入网------");
		// 批次号
		String batchNo = "B01201909032";
		// 文件路径
		String filePath = "D:/test/正式环境/test_add_mem_003.xlsx";
		String result = transferWalletClient.businessResident(batchNo, filePath);
		log.info("2.1 商户入网结果:" + result);
		log.info("------2.1 商户入网结束------");
*/


		/*log.info("------2.2 资金划转------");
		// 批次号
		String batchNo = "RFBH15";
		String fundAccountNo = "ARDE19082052367134";
		String fundAccountType = "ARDE";
		// 文件路径
		String transferFilePath = "D:/test/测试环境/商户入网模板.xlsx";
		String result = transferWalletClient.batchTransfer(batchNo, fundAccountNo, fundAccountType, transferFilePath);
		log.info("2.2 资金划转结果:" + result);
		log.info("------2.2 资金划转-----");*/





		/*log.info("------2.3 单笔提现------");
		
		// 订单号
		String orderNo = "RFTX11";
		// 提现资金账号
		//String vritualMemCode = "AR19083071895227";
		String vritualMemCode = "ARBE19082052367134";
		
		// 提现金额（单位：分）
		Long occurAmount = 100L;
		// 交易备注
		String remark = "提现测试";
		
		// 备注
		String result = transferWalletClient.cashOutForSelf(orderNo, vritualMemCode, occurAmount, remark);
		log.info("2.3 单笔提现结果:" + result);
		
		log.info("------2.3 单笔提现结束------");*/

		/*log.info("------2.5 查询开户结果------");
		int currentPage = 1;
		int pageSize = 10;
		String memFullName = null;
		String idNumber = null;
		String mobile = null;
		String bankAccount = null;
		// String memFullName = "";
		// String idNumber = "";
		// String mobile = "";
		// String bankAccount = "";
		String result = transferWalletClient.queryOpenAccount(currentPage, pageSize, memFullName, idNumber, mobile,
				bankAccount);
		log.info("2.5 查询开户结果:" + result);
		log.info("------2.5 查询开户结果结束------");*/

		/*log.info("------2.6 按批次号查询批次概要信息 ------");
		
		String batchNo = "RFBH8";
		String result = transferWalletClient.queryBatchEssentials(batchNo);
		log.info("2.6 按批次号查询批次概要信息结果:" + result);
		log.info("------2.6 按批次号查询批次概要信息结束 ------");*/

		// 2.7按批次号查询批次明细
		/*log.info("------2.7按批次号查询批次明细 ------");
		// 批次号
		String batchNo = "132465";
		// 当前页
		int currentPage = 1;
		// 每页数量
		int pageSize = 10;
		
		String result = transferWalletClient.queryBatchDetails(batchNo, currentPage, pageSize);
		log.info("------2.7按批次号查询批次明细结束------");*/

		/*log.info("------2.8  查询账务明细 ------");
		int currentPage = 1;
		int pageSize = 10;
		String startTime = "2019-08-30 11:00:00";
		String endTime = "2019-08-30 23:59:59";
		
		String result = transferWalletClient.queryAccountingDetails(currentPage, pageSize, startTime, endTime);
		log.info("2.8  查询账务明细结果:" + result);
		log.info("------2.8  查询账务明细结束------");*/

		/*log.info("------2.9 资金账户余额查询 ------");
		int currentPage = 1;
		int pageSize = 10;
		String vritualMemCode = "AR19083071895227";
		String result = transferWalletClient.queryVritualAccounts(currentPage, pageSize, vritualMemCode);
		log.info("2.9 资金账户余额查询结果:" + result);
		log.info("------2.9 资金账户余额查询结束------");*/

		/*log.info("------4.1 订单上报------");
		
		OrderSubmissionReq orderSubmissionReq = new OrderSubmissionReq();
		
		// 交易日期
		orderSubmissionReq.setInitDate("20190910");
		// 订单号
		orderSubmissionReq.setTradeOrderNo("20190910140101");
		// 卖方会员名称
		orderSubmissionReq.setSellerAccountName("北京瑞富通捷科技有限责任公司");
		
		// 卖方资金账号
		orderSubmissionReq.setSellerExchangeFundAccount("ARBE19082052367134");
		
		// orderSubmissionReq.setSellerAccountName("天津力图科技有限公司");
		// orderSubmissionReq.setSellerExchangeFundAccount("AR19090471895225");
		
		// 卖方手机号码 N
		orderSubmissionReq.setSellerTelNo("12345678901");
		// 产品编码
		orderSubmissionReq.setProductCode("00001");
		// 产品名称
		orderSubmissionReq.setProductName("测试产品");
		// 买方会员名称
		orderSubmissionReq.setBuyerAccountName("李兴军");
		// 买方资金账号
		orderSubmissionReq.setBuyerExchangeFundAccount("AR19090467189623");
		// 买方手机号码 N
		orderSubmissionReq.setBuyerTelNo("12345678901");
		// 买方证件号码 N
		orderSubmissionReq.setIdNo("12345679801");
		// 商品数量
		orderSubmissionReq.setDealQuantity(1D);
		// 商品成交类型 1-券 2-资金 3-部分券部分资金
		orderSubmissionReq.setGoodsDealType("1");
		// 商品单价
		orderSubmissionReq.setDealPrice(100L);
		// 商品券的总面额
		orderSubmissionReq.setDealTicketPrice(100L);
		// 商品总金额
		orderSubmissionReq.setDealFundPrice(0L);
		// 商品总价值
		orderSubmissionReq.setDealTotalPrice(100L);
		// 下单时间 格式：HHmmss
		orderSubmissionReq.setDealTime("111100");
		// 订单状态 1-待发货
		orderSubmissionReq.setGoodsStatus("1");
		// 备注 N
		orderSubmissionReq.setRemark("备注");
		
		String result = transferWalletClient.orderSubmission(orderSubmissionReq);
		
		log.info("4.1 订单上报结果:" + result);
		log.info("------4.1 订单上报结束------");*/

		/*log.info("------4.2 订单状态修改------");
		
		OrderChangeStatusReq orderChangeStatusReq = new OrderChangeStatusReq();
		// 交易日期 YYYYMMDD
		orderChangeStatusReq.setInitDate("20190910");
		// 订单号
		orderChangeStatusReq.setTradeOrderNo("20190910140100");
		// 订单状态 1-待发货 2-撤销 3-确认收货 4-退款
		orderChangeStatusReq.setGoodsStatus("3");
		// 发生时间 HHmmss
		orderChangeStatusReq.setOccurTime("135400");
		
		String result = transferWalletClient.orderChangeStatus(orderChangeStatusReq);
		
		log.info("4.2 订单状态修改结果:" + result);
		log.info("------4.2 订单状态修改结束------");*/

		/*log.info("------4.3 支付确认信息------");
		
		ConfirmPayReq confirmPayReq = new ConfirmPayReq();
		
		// 交易日期 YYYYMMDD
		confirmPayReq.setInitDate("20190910");
		// 订单号
		confirmPayReq.setTradeOrderNo("20190910140100");
		// 交易金额 单位/分
		confirmPayReq.setTradeAmount(100L);
		// 交易流水号
		confirmPayReq.setTradeNo("20190910140100");
		// 交易完成时间 yyyyMMddHHmmss
		confirmPayReq.setFinishTime("20190910135500");
		
		String result = transferWalletClient.confirmPay(confirmPayReq);
		
		log.info("4.3 支付确认信息结果:" + result);
		log.info("------4.3 支付确认信息结束------");*/

		/*log.info("------4.4 支付退款信息------");
		
		DrawbackReq drawbackReq = new DrawbackReq();
		
		// 交易日期 YYYYMMDD
		drawbackReq.setInitDate("20190910");
		// 原交易订单号
		drawbackReq.setTradeOrderNo("20190910140100");
		// 退款金金额 单位/分
		drawbackReq.setTradeAmount(100L);
		// 退款交易流水号
		drawbackReq.setTradeNo("20190910140100");
		// 退款完成时间 yyyyMMddHHmmss
		drawbackReq.setFinishTime("20190910135800");
		// 退款交易订单号
		drawbackReq.setRefundTradeOrderNo("20190910140100");
		
		String result = transferWalletClient.drawback(drawbackReq);
		
		log.info("4.4 支付退款信息结果:" + result);
		log.info("------4.4 支付退款信息结束------");*/

		/*log.info("------2.10 单笔资金账户划转------");
		
		// 出款方资金账号
		String fromFundAccountNo = "ARDE19082052367134";
		// 入款方资金账号
		String toFundAccountNo = "ARBE19082052367134";
		// 发生金额（单位/分）
		String occurAmount = "1000";
		// 商户订单号
		String orderNo = "RFTM3";
		
		String result = transferWalletClient.singleTransfer(fromFundAccountNo, toFundAccountNo, occurAmount, orderNo);
		
		log.info("2.10 单笔资金账户划转结果:" + result);
		log.info("------2.10 单笔资金账户划转结束------");*/

	}
}
